#include<bits/stdc++.h>
using namespace std;
int t,n,m,L,V,d[5][10000],u[5][10000],a[5][10000],p[10000];
int main(){

freopen(" detect.in","r",stdin);
freopen(" detect.out","w",stdout);
cin>>t;
cin>>n>>m>>L>>V;
for(int i=1;i<=3;i++){
    for(int j=1;j<=n;j++){
        cin>>d[i][j];
        cin>>u[i][j];
        cin>>a[i][j];
    }
}
for(int k=1;k<=m;k++){
    cin>>p[k];
}


cout<<"3"<<" "<<"3";
fclose(stdin);
fclose(stdout);
return 0;
}
